<?php

$tambah = false;

$q_p31 = mysql_query("
	SELECT * FROM t_p31
	WHERE kd_perkara ='".KD_PERKARA."'");

$dt	= mysql_fetch_array($q_p31);
				
?>

<form id="da-form-p31" class="da-form" method="post" action="modul/perkara/detail.proses.php">
	<div class="da-form-inline">
		<div class="da-form-row">
			<label class="da-form-label">Nomor Surat</label>
			<div class="da-form-item">
			<?php 
				$no_surat_print = '';
				$no_surat = '';
				if(data_tersedia('t_p31',KD_PERKARA)) {
					$no_surat 	= $dt['no_surat'];
					$no_surat_print = 'PRINT- '.$no_surat.'/0.5.10.3/'.$dt_spdp['jns_pidana'].konversi_tanggal('/m/Y',$dt['tgl_dikeluarkan']);
					
				} else {
					$tambah 	= true;
					$no_surat 	= p31_register($dt_spdp['kd_pidana']);
					$no_surat_print = 'PRINT- '.$no_surat.'/0.5.10.3/'.$dt_spdp['jns_pidana'].date('/m/Y');
				} 
				echo $no_surat_print;
				?>
				
				<input 
					type="hidden" 
					name="no_surat" 
					value="<?php echo $no_surat ?>" 
					/>
					
			</div>
		</div>
		
		<div class="da-form-row">
			<label class="da-form-label">Tanggal Dikeluarkan</label>
			<div class="da-form-item">
				<input 
					id="da-tgl-p31-dikeluarkan" 
					type="text" 
					placeholder="Tanggal Dikeluarkan" 
					name="tgl_dikeluarkan" 
					value="<?php echo isset($dt['tgl_dikeluarkan'])?konversi_tanggal('d-M-Y',$dt['tgl_dikeluarkan']):'' ?>">
			</div>
		</div>
		
		<div class="da-form-row">
			<label class="da-form-label">Tempat Dikeluarkan</label>
			<div class="da-form-item">
				<input 
					type="text" 
					name="tmp_dikeluarkan"  
					placeholder="Tempat Dikeluarkan"  
					value="<?php echo $dt['tmp_dikeluarkan'] ?>">
			</div>
		</div>
		
		<div class="da-form-row">
			<label class="da-form-label">Penyidik</label>
			<div class="da-form-item">
				<input 
					type="text" 
					name="penyidik"  
					placeholder="Penyidik"  
					value="<?php echo $dt['penyidik'] ?>">
			</div>
		</div>
		
		<div class="da-form-row">
			<label class="da-form-label">Perpanjangan</label>
			<div class="da-form-item">
				<input 
					type="text" 
					name="perpanjangan"  
					placeholder="Perpanjangan"  
					value="<?php echo $dt['perpanjangan'] ?>">
			</div>
		</div>

		<div class="da-form-row">
			<label class="da-form-label">Penuntut Umum</label>
			<div class="da-form-item">
				<input 
					type="text" 
					name="penuntut_umum"  
					placeholder="Penuntut Umum"  
					value="<?php echo $dt['penuntut_umum'] ?>">
			</div>
		</div>
				
	</div>
	<?php if(LEVEL=="superadmin" || LEVEL=="admin" || LEVEL=="kasipidum" || LEVEL=="penuntutan") { ?>
	<div class="btn-row">
		<!--button class="btn"><i class="icol-calendar-2"></i> Riwayat Dokumen</button-->
		<?php if(!$tambah) { ?>
			<a href="#" id="p31-dialog" class="btn"><i class="icol-printer"></i> Cetak</a>
		<?php } else { ?>
			<a href="#" class="btn disabled"><i class="icol-printer"></i> Cetak</a>
		<?php } 
			if($tambah){
		?>
			<button id="tambah-p31" class="btn"><i class="icol-disk"></i> Simpan</button>
		<?php }else{?>
			<button id="ubah-p31" class="btn"><i class="icol-disk"></i> Simpan</button>
		<?php }?>
		<input id="mode-input" type="hidden" name="p31" value="tambah" />
		<input type="hidden" name="kd" value="<?php echo KD_PERKARA ?>" />
	</div>
</form>
<?php } ?>
<div id="p31-dialog-div" style="display:none;">
	<p id="berkas"></p>
</div>
